#!/usr/bin/env python
# coding=utf-8
# 15/4/4 22:28 zhuxuehuang

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mydj.settings")
import django
django.setup()

from app.models import Message, MessageUser

# for i in range(11, 20):
#     m = Message.objects.create(title='aaaa%s' % i)
#     mu = MessageUser()
#     mu.message_id = m
#     mu.save()

m = Message.objects.get(id=16)
print(m)

m2 = m.messageuser_set.all()[0]
print(m2.user_id)

mu = MessageUser.objects.get(message_id=17)
print(mu)
print(mu.user_id)
print(mu.id)
m3 = MessageUser.objects.filter(title__exact='aaaa18')
print(m3)
# mu2 = mu.message.__dict__
# print(mu2)